

use "$data/clean/clean_main_complete.dta" , replace


loc experiments " any_doors  doors_wins n_intendedact  z_score_fs"

	  
		   
preserve

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments'  {

    loc ++columns
    qui eststo col`columns': reg x y

}

restore


/* Statistics */

loc colnum = 1
loc colnames ""


foreach choice in `experiments' {

/* Statistics */

 
********************************Panel A*****************************************
	

	
 xi: reg `choice' treat_any $control , vce(r) // 
   
   
   
    sigstar treat_any   , prec(3)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
   

	
	
    loc ++colnum
    loc colnames "`colnames' `"`: var la `choice''"'"	
	

	}
	/* Statistics */

loc colnum = 1
loc colnames ""


foreach choice in `experiments' {

/* Statistics */



 
 
********************************Panel B*****************************************
	

	
   
    xi: reg `choice'  voice_instrumental_pooled  voice_intrinsic_pooled  $control , vce(r) // 
   
   
    sigstar  voice_instrumental_pooled   , prec(3)
    estadd loc thisstat8 = "`r(bstar)'": col`colnum'
    estadd loc thisstat9 = "`r(sestar)'": col`colnum'
   
	sigstar voice_intrinsic_pooled  , prec(3)
    estadd loc thisstat11 = "`r(bstar)'": col`colnum'
    estadd loc thisstat12 = "`r(sestar)'": col`colnum'

   
   
   
	test    voice_instrumental_pooled = voice_intrinsic_pooled  
    estadd loc thisstat14 = string(`r(p)', "%9.2f"): col`colnum'


    loc ++colnum


	}
	

	/* Statistics */

loc colnum = 1
loc colnames ""


foreach choice in `experiments' {

/* Statistics */



 
 
********************************Panel A*****************************************

	
 xi: reg `choice' feedback_pooled  no_feedback_pooled   $control  , vce(r) // 
   
	 
   
    
    sigstar feedback_pooled   , prec(3)
    estadd loc thisstat18 = "`r(bstar)'": col`colnum'
    estadd loc thisstat19 = "`r(sestar)'": col`colnum'
   
    sigstar no_feedback_pooled , prec(3)
    estadd loc thisstat21 = "`r(bstar)'": col`colnum'
    estadd loc thisstat22 = "`r(sestar)'": col`colnum'
	
		
	test 	 feedback_pooled  = no_feedback_pooled

	estadd loc thisstat24 = string(`r(p)', "%9.2f"): col`colnum'
		 
	qui sum `choice' if control==1
	estadd loc thisstat25 = string(`r(mean)', "%9.2f"): col`colnum'
	
	qui sum `choice' 
    estadd loc thisstat26 = string(`r(N)', "%9.0f"): col`colnum'
	
	
		qui sum `choice' 
    estadd loc thisstat27 = "X": col`colnum'


	
    loc ++colnum

	}
	
	
	
	
	 

	
	
	
	 
loc rowlabels " "\textbf{Panel A: Main effects} " " " "Any voice treatment" " " " " "\hline  " "\textbf{Panel B: Type of voice} \\ " " Instrumental" " " " "  "Intrinsic" " " " "  "\hline p(Instrumental = Intrinsic)" " \hline"  "\textbf{Panel C: Feedback announcement} \\ " " " "Feedback announcement" " " " "  "No feedback announcement" " " " "  "\hline p(Feedback = No feedback)" " \hline Control mean" "Number of Observations" "Controls" "

loc rowstats ""

forval i = 1/26 {
    loc rowstats "`rowstats' thisstat`i'"
}



esttab col* using "$output/treat_doors_fs_pooled_3panel.tex", replace cells(none) booktabs nonotes  compress alignment(c) nogap noobs nobaselevels label stats(`rowstats', labels(`rowlabels')) ///
 mtitle("Any" "Doors (wins)"  "\# intended activities"   "Voice index (z)" ) mgroups("App data" "Survey data",  pattern(1 0  1 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))


